home *** CD-ROM | disk | FTP | other *** search
- 10 'PRNCHECK.BAS - A program to print selected checks on the printer
- 20 'From the GW-BASIC Tutorial Series (GWBT04 homework from 09/15)
- 30 '
- 40 'A Reminder: Our CHECKS.DAT format is as follows:
- 50 '
- 60 'CHECKNO Six characters containing the check number
- 70 'CHECKDATE Ten characters containing the check date (mm/dd/yyyy)
- 80 'CHECKPAIDTO Fifty characters containing the payor of the check
- 90 'CHECKAMOUNT Ten characters containing the amount of the check (nnnnnn.nn)
- 100 'CHECKMEMO Forty characters containing the memorandum field
- 110 '
- 120 'What we need to do is get the desired starting and ending check numbers
- 130 'from the user, then check each record in order to see if it falls between
- 140 'the desired range and print it if so.
- 150 '
- 160 CLS
- 170 LOCATE 25,1,0
- 180 PRINT"PRNCHECK - Specify range of checks to print on the printer";
- 190 LOCATE 1,1,0
- 200 INPUT "What is the FIRST check number to print";STARTNUMBER
- 210 INPUT "What is the LAST check number to print";ENDNUMBER
- 220 PRINT
- 230 PRINT "Opening CHECKS.DAT file, please wait..."
- 240 'The following statement sets up your printer to print lines of any width
- 250 'without adding extra carriage returns. If your printer is on the second
- 260 '
- 270 'LPT port (LPT2), change all the "LPT1:" statements to "LPT2:"
- 280 WIDTH "LPT1:",255
- 290 'This statement sets your printer up for condensed print mode
- 300 '
- 310 LPRINT CHR$(27);CHR$(15);
- 320 'Now that the printer is set up, let's dig into CHECKS.DAT and see what
- 330 'we can find to print...
- 340 '
- 350 OPEN "CHECKS.DAT" FOR INPUT AS #1
- 360 'Next, set up a loop (in this case, we'll use WHILE/WEND) to read in all
- 370 'the checks to see if any of them match the range we want to print...
- 380 '
- 390 WHILE NOT EOF(1)
- 400 LINE INPUT #1,CHECKDATA$
- 410 CHECKNUMBER$=LEFT$(CHECKDATA$,6)
- 420 CHECKNUMBER=VAL(CHECKNUMBER)
- 430 IF CHECKNUMBER > STARTNUMBER THEN IF CHECKNUMBER < ENDNUMBER THEN LPRINT CHECKDATA$
- 440 WEND
- 450 '
- 460 'Note that all of the statements between the WHILE and WEND will be repeated
- 470 'AS LONG AS the test (NOT EOF(1) [not end of file on #1] is true, that is,
- 480 'we are not at the end of the file. When we reach the end of the file,
- 490 'the program continues on the NEXT line number following the WEND...
- 500 CLOSE #1
- 510 PRINT
- 520 PRINT "Check printing is finished! Thank you for waiting."
- 530 END
- 540 'End of program - PRNCHECK.BAS from GWBT05 10/15/1990